//
//  TCM_MessageDetailsViewController.swift
//  TCM_TradingProject
//
//  Created by 吕春海 on 2018/8/27.
//  Copyright © 2018年 lvchunhai. All rights reserved.
//

import UIKit

class TCM_MessageDetailsViewController: UIViewController,UITableViewDataSource,UITableViewDelegate {

    var messageDetailsTableView:UITableView!
    let messageArry:[String] = ["您需要的10000千克云南自贡20头三七准备...", "有人在三七的拍卖活动中报价超过你啦，请我究竟是谁的讲究的是看看我", "恭喜您，您的认证资料已经审核通过，可以我的计算机的考试开始看的看看看都是当时开的是开始的思考的认证资料已经审核通过，可以我的计算机的考试开始看的看看看都是当时开的是开始的思考的认证资料已经审核通过，可以我的计算机的考试开始看的看看看都是当时开的是开始的思考"]
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view .backgroundColor = UIColor.white
        // Do any additional setup after loading the view.
        setTabelView()
    }

    func setTabelView() {
        self.messageDetailsTableView = UITableView(frame: CGRect(x: 0, y: TCM_NavBarHeight(), width: TCM_ScreenWidth, height: TCM_ScreenHeight - TCM_NavBarHeight()), style:UITableViewStyle.plain)
        self.messageDetailsTableView.backgroundColor = TCM_HexRGB(0xF0F0F0)
        self.messageDetailsTableView.separatorStyle = UITableViewCellSeparatorStyle.none
        self.messageDetailsTableView.showsVerticalScrollIndicator = false
        self.messageDetailsTableView.delegate = self
        self.messageDetailsTableView.dataSource = self
        
        self.messageDetailsTableView.rowHeight = UITableViewAutomaticDimension
        self.messageDetailsTableView.estimatedRowHeight = 200
    
        self.view.addSubview(messageDetailsTableView)
        
        self.messageDetailsTableView.register(UINib.init(nibName: "TCM_MessageDetailsTableViewCell", bundle: nil), forCellReuseIdentifier: "MessageDetailsCell")
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }
    
    func numberOfSections(in tableView: UITableView) -> Int {
        return messageArry.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        let cell = (messageDetailsTableView.dequeueReusableCell(withIdentifier: "MessageDetailsCell", for: indexPath)) as! TCM_MessageDetailsTableViewCell
        cell.messageLabel.text = messageArry[indexPath.section]
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 0.00001
    }
    
    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        return nil
    }
    
    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 8
    }
    
    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        let footerView = UIView()
        footerView.frame = CGRect(x: 0, y: 0, width: TCM_ScreenWidth, height: 8)
        footerView.backgroundColor = TCM_HexRGB(0xF0F0F0)
        return footerView
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
